package com.itheima.day14_多线程.Test04;

import java.util.concurrent.ArrayBlockingQueue;

public class User extends Thread{
    private ArrayBlockingQueue<String> abq;
    public User(ArrayBlockingQueue<String> abq) {
        this.abq = abq;
    }

    @Override
    public void run() {
        while(true) {
            try {
                Thread.sleep(1000);
                String take = abq.take();
                System.out.println("用户从箱子中获取到"+take);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
